package chatgpt;

import chatgpt.entity.images.Generations;
import chatgpt.entity.images.ImagesRensponse;
import chatgpt.entity.images.Variations;
import chatgpt.util.Proxys;
import com.ruoyi.common.config.RuoYiConfig;

import java.io.File;
import java.net.Proxy;
import java.util.List;

/**
 * @Author matoooo
 * @Date 2023/8/25 14:48
 * @Description: TODO
 */
public class Test {

    //国内需要代理
    Proxy proxy = Proxys.http("127.0.0.1", 1081);
    //socks5 代理
    // Proxy proxy = Proxys.socks5("127.0.0.1", 1080);

    public static void main(String[] args) {
        ChatGPT chatGPT = ChatGPT.builder()
                .apiKey("sk-64zKz69svXDWdkfQA66d79C009F947F8A658E1Dd5292E2Ab")

//                .proxy(proxy)
                .apiHost("https://hixtebrwfjyc.cloud.sealos.io/") //代理地址
                .build()
                .init();

        String res = chatGPT.chat("提取下面内容中律师的名字和律师事务所全称，格式必须是：律师名字/律所名称，如果其中一个没找到则该名称为无，直接告诉人名/律所全称（中间用/隔开） 即可，回答字数不能超过20个字。" +
                "内容：车配能,云南凌云律师事务所律师,艰难而努力前行");
        System.out.println(res);
//        System.out.println(chatGPT.balance());


    }
//    public static void main(String[] args) {
////        Proxy proxys = Proxys.http("127.0.0.1",10809);
//        Images images = Images.builder()
////                .proxy(proxys)
//                .apiKey("sk-vM175qlqxg9jT5RsBc4e402d84904c59Bc00Dc8f4fCf1640")
//                .apiHost("https://api.xi-ai.cn/")
//                .timeout(900)
//                .build()
//                .init();
//
//        File file = new File("C:\\Users\\竹子\\Desktop\\10.jpg");
//        Variations variations = Variations.ofURL(1,"256x256");
//        Generations generations = Generations.ofURL("市场的厨房中有一位贤妻良母，并尝试去除图中水印",1,"456x456");
//        ImagesRensponse imagesRensponse = images.variations(file,variations);
//        System.out.println(imagesRensponse.getCreated());
//        System.out.println(imagesRensponse.getCode());
//        System.out.println(imagesRensponse.getMsg());
//        List<Object> data = imagesRensponse.getData();
//        for(Object o:data){
//            System.out.println(o.toString());
//        }
        /*Audio audio = Audio.builder()
                .proxy(proxys)
                .apiKey("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")
                .apiHost("https://api.openai.com/")
                .timeout(900)
                .build()
                .init();
        File file = new File("D:\\Jenny.mp3");
        Transcriptions transcriptions = Transcriptions.of(file, AudioModel.WHISPER1.getValue());
        AudioResponse response = audio.transcriptions(transcriptions);
        System.out.println(response.getText());*/
//    }
}
